/*
day159_2
2020.2.3
*/
#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    int minCostClimbingStairs(vector<int>& cost) {
        int a=0,b=0;
        int res=0;
        for(int i=0;i<cost.size();++i)
        {
        	res = (a < b ? a : b) + cost[i];
        	a=b;
        	b=res;
		}
		return (res < a ? res : a);
    }
};

int main()
{
	vector<int> cost{0,0,0,0};
	Solution s;
	cout<<s.minCostClimbingStairs(cost)<<endl;
	return 0;
}
